public class ChickenAndRabbit {
    /**
     * 鸡兔同笼问题
     * author:王锦林
     * date:2025-6-13
     * @param args
     */
    public static void main(String[] args) {
       int totalHead=50;
       int totalFoot=160;
        for(int chicken=0;chicken<=totalHead;chicken++){
            if((totalHead-chicken)*4+chicken*2==totalFoot)
            {
                System.out.println("鸡的数目是："+chicken);
                System.out.println("兔子的数目是："+(totalHead-chicken));
                break;
            }
        }
    }

}
